<template>
    <view>
        <custom><template #backText>{{seller_type_name}}开通全国邮寄</template></custom>
        <nFormItem key="form_seller_info_is_pay_open_express" v-if="pay.form.seller_type=='0'" title="开通状态" :value="$store.state.user.identity_info.seller_info.is_pay_open_express==0?'未开通':'已开通'">
        </nFormItem>
        <nFormItem key="form_seller_info_is_pay_open_express_firm" v-if="pay.form.seller_type=='1'" title="开通状态" :value="$store.state.user.identity_info.seller_info.is_pay_open_express_firm==0?'未开通':'已开通'">
        </nFormItem>
        <nFormItem key="form_open_express_price" title="诚信保证金" :value="open_express_price"></nFormItem>
        <nFormButton v-if="pay.form.seller_type=='0' && $store.state.user.identity_info.seller_info.is_pay_open_express==0" :title="seller_type_name + '开通全国邮寄'" :tap="()=>{pay.show=true}"></nFormButton>
        <nFormButton v-if="pay.form.seller_type=='1' && $store.state.user.identity_info.seller_info.is_pay_open_express_firm==0" :title="seller_type_name + '开通全国邮寄'" :tap="()=>{pay.show=true}"></nFormButton>
        <pay :pay.sync="pay"></pay>
    </view>
</template>

<script>
    export default {
        data() {
            return {
                seller_type_name: '',
                open_express_price: '',
                pay: {
                    formtag: {},
                    form: {},
                    formbak: {},
                    tip_content: '确定要开通全国邮寄吗？',
                    pay_uri: '/user/pay/openExpress',
                    show: false,
                    load_info: {},
                },
            }
        },
        onLoad(params) {
            if (!params.seller_type) {
                this.$store.commit('appBackPage');
                return;
            }
            this.pay.load_info = params;
            this.pay.form.seller_type = this.pay.formbak.seller_type = params.seller_type;
            this.seller_type_name = this.$dict.get('seller_type_name', this.pay.form.seller_type);
            this.$api.config(this, this.seller_type_name + '.开通全国邮寄的费用', (config) => {
                this.open_express_price = config[this.seller_type_name + '.开通全国邮寄的费用'];
            })
        },
    }
</script>
